import React from "react";
import App from "./App";

import { Route, Redirect } from "react-router-dom";
import Auth from "./components/Auth";

import Home from "./pages/home/Index";
import Login from "./pages/login/Index";
import Register from "./pages/register/Index";
import Detail from "./pages/detail/Index";
import NotFount from "./pages/404/Index";

import Home2 from "./pages/home/home/Index";
import Classify from "./pages/home/classify/Index";
import Cart from "./pages/home/cart/Index";
import Mine from "./pages/home/mine/Index";

const Router = () => {
  return (
    <App>
      <Redirect from="/" to="/home" exact></Redirect>
      <Route path="/home">
        <Home>
          <Redirect from="/home" to="/home/home" exact></Redirect>
          <Route path="/home/home">
            <Home2 />
          </Route>
          <Route path="/home/classify">
            <Classify />
          </Route>
          <Auth path="/home/cart">
            <Cart />
          </Auth>
          <Auth path="/home/mine">
            <Mine />
          </Auth>
        </Home>
      </Route>
      <Route path="/login">
        <Login />
      </Route>
      <Route path="/register">
        <Register />
      </Route>
      <Route path="/detail">
        <Detail />
      </Route>
      <Route path="*">
        <NotFount />
      </Route>
    </App>
  );
};

export default Router;
